package cn.nexd.app.collector.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

import com.umeng.analytics.MobclickAgent;

import cn.nexd.app.collector.R;
import cn.nexd.app.collector.application.Version;
import cn.nexd.framework.util.PhoneUtil;


public class AboutActivity extends AppCompatActivity {
    private Toolbar tlBar;

//    private BasicPhoneInformation basicPhoneInformation;
    private TextView tvAppVersion, tvAndroidVersion, tvCollectorVersion, tvUserDecaler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);
        initData();
        initToolBar();
        initView();
        bindData();
    }

    private void bindData() {
        tvAppVersion.setText("当前版本：" + Version.VERSION);
        tvAndroidVersion.setText("设备系统版本：" + PhoneUtil.getInstance(this).getPhoneModel() + "(" + PhoneUtil.getInstance(this).getAndroidVersion() + ")");
        tvCollectorVersion.setText("采集器版本：V_100");
    }


    private void initView() {
        tvAppVersion = (TextView) findViewById(R.id.about_app_version);
        tvAndroidVersion = (TextView) findViewById(R.id.about_android_version);
        tvCollectorVersion = (TextView) findViewById(R.id.about_collector_version);
        tvUserDecaler = (TextView) findViewById(R.id.about_user_declare);
    }

    private void initData() {
//        basicPhoneInformation = BasicPhoneInformation.getInstance(this);

    }

    @Override
    protected void onResume() {
        super.onResume();
        MobclickAgent.onResume(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        MobclickAgent.onPause(this);
    }

    private void initToolBar() {
        tlBar = (Toolbar) findViewById(R.id.about_tl);
        setSupportActionBar(tlBar);
        getSupportActionBar().setTitle("");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.icon_back);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                this.finish();
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    public void onEnterClick(View view) {
        Intent intent = new Intent(this, GuideBookActivity.class);
        startActivity(intent);
//        Toast.makeText(AboutActivity.this, "用户手册", Toast.LENGTH_SHORT).show();
    }


}
